package com.shenzhenai.jetpackcomposelayouts

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.shenzhenai.jetpackcomposelayouts.ui.theme.DN_Compose_LearnTheme

/**
 *
 * 15 - 标准布局组件
 * https://www.bilibili.com/video/BV1ob4y1a7ad?spm_id_from=333.788.player.switch&vd_source=e07cc8cc94eb22bd76722071b03cd199&p=15
 *
 * 16 - Slots Api （就是槽位api）
 * https://www.bilibili.com/video/BV1ob4y1a7ad?spm_id_from=333.788.player.switch&vd_source=e07cc8cc94eb22bd76722071b03cd199&p=16
 *
 * 17 - 使用列表
 * https://www.bilibili.com/video/BV1ob4y1a7ad?spm_id_from=333.788.player.switch&vd_source=e07cc8cc94eb22bd76722071b03cd199&p=17
 *
 * 18 - 自定义布局 - 使用修饰符
 * https://www.bilibili.com/video/BV1ob4y1a7ad?spm_id_from=333.788.player.switch&vd_source=e07cc8cc94eb22bd76722071b03cd199&p=18
 *
 * 19 - 仿 Column 组件
 * https://www.bilibili.com/video/BV1ob4y1a7ad?spm_id_from=333.788.player.switch&vd_source=e07cc8cc94eb22bd76722071b03cd199&p=19
 *
 * 20 - 自定义布局 StaggeredGrid 上
 * https://www.bilibili.com/video/BV1ob4y1a7ad?spm_id_from=333.788.player.switch&vd_source=e07cc8cc94eb22bd76722071b03cd199&p=20
 *
 * 21 - 自定义布局 StaggeredGrid 下
 * https://www.bilibili.com/video/BV1ob4y1a7ad?spm_id_from=333.788.player.switch&vd_source=e07cc8cc94eb22bd76722071b03cd199&p=21
 *
 * 22 - 约束布局
 * https://www.bilibili.com/video/BV1ob4y1a7ad?spm_id_from=333.788.player.switch&vd_source=e07cc8cc94eb22bd76722071b03cd199&p=22
 *
 * 23 - 解耦 api
 * https://www.bilibili.com/video/BV1ob4y1a7ad?spm_id_from=333.788.videopod.episodes&vd_source=e07cc8cc94eb22bd76722071b03cd199&p=23
 *
 *
 * 24 - 布局多次测量(Intrinsics)
 * 因为 compose 是不允许多次测量的，如果多次测量会抛运行实异常
 * 有些时候，我们需要提前知道控件的最大宽度和最小宽度，则需要涉及多次测量
 * https://www.bilibili.com/video/BV1ob4y1a7ad?spm_id_from=333.788.player.switch&vd_source=e07cc8cc94eb22bd76722071b03cd199&p=24
 *
 */
class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContent {
//            DN_Compose_LearnTheme {
////                Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
//////                    Greeting(
//////                        name = "Android",
//////                        modifier = Modifier.padding(innerPadding)
//////                    )
////                    PhotographerCard(modifier = Modifier.padding(innerPadding))
////                }
//
//
////                LayoutStudy()
//
////                LazyList()
//
//               Scaffold(modifier = Modifier.fillMaxSize()) {innerPadding->
//                   ScrollingList(innerPadding)
//               }
//            }

//            TextWithPaddingToBaseline()
//            MyOwnColumnSample()
//            StaggeredGridSample()
//            ConstraintLayoutContentSample()
            TowTextsSample()
        }
    }
}

@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
    Text(
        text = "Hello $name!",
        modifier = modifier
    )
}

@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
    DN_Compose_LearnTheme {
        Greeting("Android")
    }
}